package com.zerui.manager.web;

import com.zerui.authority.annotation.Authorize;
import com.zerui.cola.dto.PageResponse;
import com.zerui.cola.dto.Response;
import com.zerui.manager.web.cmd.AccessAuthPersonnelBindCmd;
import com.zerui.manager.web.cmd.AccessAuthPersonnelQryCmd;
import com.zerui.manager.web.vo.AccessAuthPersonnelVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;

/**
 * @Author wh
 * @create_time 2023-08-23 15:33
 */
@Validated
@Api(value = "门禁授权人员绑定", tags = "门禁设备管理")
@RestController
@RequestMapping("/api/v1/access/auth/personnel")
public class AccessAuthPersonnelController {

    @Resource
    private AccessAuthPersonnelService accessAuthPersonnelService;

    @ApiOperation(value = "门禁授权人员分页列表", tags = "门禁授权管理")
    @PostMapping("/getPageList")
    public PageResponse<AccessAuthPersonnelVO> getPageList(@RequestBody @Validated AccessAuthPersonnelQryCmd accessAuthPersonnelQryCmd) {
        return accessAuthPersonnelService.getPageList(accessAuthPersonnelQryCmd);
    }

    @ApiOperation(value = "门禁授权 - 人员绑定", tags = "门禁授权管理")
    @PostMapping("/bind")
    public Response add(@RequestBody @Validated AccessAuthPersonnelBindCmd accessAuthPersonnelBindCmd) {
        return accessAuthPersonnelService.add(accessAuthPersonnelBindCmd);
    }

    @ApiOperation(value = "门禁授权 - 人员取消绑定", tags = "门禁授权管理")
    @PostMapping("/cancel/bind")
    public Response delete(@RequestBody @Validated AccessAuthPersonnelBindCmd accessAuthPersonnelBindCmd) {
        return accessAuthPersonnelService.delete(accessAuthPersonnelBindCmd);
    }

}
